package com.mexico.inloancash.adapter;


import android.content.Intent;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mexico.inloancash.R;
import com.mexico.inloancash.activity.IndiaWebViewActivity;
import com.mexico.inloancash.bean.India_Billing_ListBean;
import com.mexico.inloancash.utils.MyPreferencesManager;

import java.text.SimpleDateFormat;

public class IndiaCouponAdapter extends BaseQuickAdapter<India_Billing_ListBean.DataBean, BaseViewHolder> {

    public IndiaCouponAdapter() {
        this(R.layout.india_activity_item_view_layout_coupon);
    }

    public IndiaCouponAdapter(int layoutResId) {
        super(layoutResId);
    }

    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

    @Override
    protected void convert(BaseViewHolder helper, final India_Billing_ListBean.DataBean item) {
        try {
            if (item.getCoupon_amount() > 0) {
                helper.setText(R.id.all_count, "" + item.getCoupon_amount());
            }
            helper.getView(R.id.pay_money_button).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Intent web = new Intent(mContext, IndiaWebViewActivity.class);
                    web.putExtra("web", MyPreferencesManager.getString("payweb", ""));
                    web.putExtra("type", 2);//拒绝后跳转的H5
                    web.putExtra("orderno", item.getOrderno());
                    mContext.startActivity(web);
                }
            });
        } catch (Exception e) {

        }
    }
}
